//arcaea转phigros
#include <stdio.h>
#include <string.h>
char zf[1000010];int n,w;
void readall()
{
    char ch;
    while((ch=getchar())!=EOF)
        zf[n++]=ch;
    zf[n]=0;
}
void readuntil(char x)
{
    while(w<n&&zf[w]!=x)
        w+=1;
}
int readword(char jg[100])
{
    int m=0;
    while(w<n&&zf[w]>='a'&&zf[w]<='z')
        jg[m++]=zf[w++];
    jg[m]=0;
    return m;
}
int readnumber()
{
    int rt=0;
    while(w<n&&zf[w]>='0'&&zf[w]<='9')
        rt=rt*10+zf[w++]-'0';
    return rt;
}
double readR()
{
    char ch[100]={0};int s=0;
    while(w<n&&(zf[w]=='.'||(zf[w]>='0'&&zf[w]<='9')))
        ch[s++]=zf[w++];
    double rt;
    sscanf(ch,"%lf",&rt);
    return rt;
}
void skip(int s=1)
{
    w+=s;
}
void readendl()
{
    while(zf[w]=='\n'||zf[w]=='\r'||zf[w]==';')
        w+=1;
}
double cal(int t1,int t2,double x1,double x2,int t)
{
    if(t1==t2)return (x1+x2)/2;
    double k=(x2-x1)/(t2-t1);
    double b=x1-t1*k;
    return k*t+b;
}
char ch1[1000010],ch2[1000010],ch3[1000010];bool bt[1000010],bd[1000010];
int main()
{
    freopen("2.aff","r",stdin);
    freopen("a.json","w",stdout);
    readall();double bpm=102;
    double k=9,b=-4.5,spd=1.6,kt=32*bpm/60000;
    int c1=-1,c2=0,c3=0;
    while(w<n)
    {
        if(zf[w]=='(')//tap
        {
            skip();
            int tm=readnumber();
            skip();
            int Tm=tm*kt+0.5,ty=1;
            double x=readnumber();
            x=(x-1)/3;char tt[1000]={0};
            if(bt[tm])ty=4;bd[tm]=1;
            sprintf(tt,"{\"type\":%d,\"time\":%d,\"positionX\":%.8lf,\"holdTime\":0.0,\"speed\":%.1lf,\"floorPosition\":%.8lf},\n",ty,Tm,x*k+b,1.0,tm*spd/1000.0);
            strcat(ch1,tt);c1+=1;
            readuntil(';');readendl();
        }
        else
        {
            char ch[1000];readword(ch);
            if(strcmp(ch,"arc")==0)
            {
                skip();
                int tm1=readnumber();
                skip();
                int Tm1=tm1*kt+0.5;
                int tm2=readnumber();
                skip();
                int Tm2=tm2*kt+0.5;
                double x1=readR();
                skip();
                double x2=readR();
                skip();
                readuntil(',');skip();
                double y1=readR();
                skip();
                double y2=readR();
                skip();
                readuntil(')');skip();
                if(zf[w]=='[') //arctap
                {
                    skip();
                    while(zf[w]=='a')
                    {
                        skip(7);
                        int tm=readnumber();
                        int Tm=tm*kt+0.5;
                        double x=cal(tm1,tm2,x1,x2,tm);
                        int ty=1;char tt[1000]={0};
                        if(bd[tm])ty=4;bt[tm]=1;
                        //if(y1!=1||y2!=1)ty=4;
                        sprintf(tt,"{\"type\":%d,\"time\":%d,\"positionX\":%.8lf,\"holdTime\":0.0,\"speed\":%.1lf,\"floorPosition\":%.8lf},\n",ty,Tm,(x*k+b)/2+3,1.0,tm*spd/1000.0);
                        skip(2);strcat(ch2,tt);c2+=1;
                    }
                }
                else if(zf[w-3]=='s')
                {
                    int d=15000/bpm;
                    for(int t=tm1;t<=tm2;t+=d)
                    {
                        double x=cal(tm1,tm2,x1,x2,t);char tt[100]={0};
                        sprintf(tt,"{\"type\":2,\"time\":%d,\"positionX\":%.8lf,\"holdTime\":0.0,\"speed\":%.1lf,\"floorPosition\":%.8lf},\n",int(t*kt+0.5),(x*k+b)/2-3,1.0,t*spd/1000.0);
                        strcat(ch3,tt);c3+=1;
                    }
                }
                readendl();
            }
            else if(strcmp(ch,"timing")==0)
            {
                skip();
                int tm=readnumber();
                readuntil(';');readendl();
            }
            else //hold
            {
                skip();
                int tm1=readnumber();
                skip();
                int Tm1=tm1*kt+0.5;
                int tm2=readnumber();
                skip();
                int Tm2=tm2*kt+0.5;
                double x=readnumber();
                x=(x-1)/3;char tt[1000]={0};
                sprintf(tt,"{\"type\":3,\"time\":%d,\"positionX\":%.8lf,\"holdTime\":%.1lf,\"speed\":%.1lf,\"floorPosition\":%.8lf},\n",Tm1,x*k+b,double(Tm2-Tm1),spd,tm1*spd/1000.0);
                readuntil(';');readendl();strcat(ch1,tt);c1+=1;
            }
        }
    }
    int s1=strlen(ch1);
    int s2=strlen(ch2);
    int s3=strlen(ch3);
    ch1[s1-2]=0;ch2[s2-2]=0;ch3[s3-2]=0;
    printf("{\"formatVersion\":3,\"offset\":0.0,\"numOfNotes\":%d,\"judgeLineList\":[{\"numOfNotes\":%d,\"numOfNotesAbove\":%d,\"numOfNotesBelow\":0,\"bpm\":%.2lf,\"speedEvents\":[{\"startTime\":0.0,\"endTime\":1000000000.0,\"floorPosition\":0.0,\"value\":%.2lf}],\"notesAbove\":[%s],\"notesBelow\":[],\"judgeLineDisappearEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0},{\"startTime\":0.0,\"endTime\":1000000000.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0}],\"judgeLineMoveEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":0.5,\"end\":0.5,\"start2\":0.5,\"end2\":0.5},{\"startTime\":0.0,\"endTime\":128.0,\"start\":0.5,\"end\":0.5,\"start2\":0.5,\"end2\":0.19999998807907105},{\"startTime\":128.0,\"endTime\":1000000000.0,\"start\":0.5,\"end\":0.5,\"start2\":0.19999998807907105,\"end2\":0.19999998807907105}],\"judgeLineRotateEvents\":[{\"startTime\":-999999.0,\"endTime\":1000000000.0,\"start\":0.0,\"end\":0.0,\"start2\":0.0,\"end2\":0.0}]},{\"numOfNotes\":%d,\"numOfNotesAbove\":%d,\"numOfNotesBelow\":0,\"bpm\":%.2lf,\"speedEvents\":[{\"startTime\":0.0,\"endTime\":1000000000.0,\"floorPosition\":0.0,\"value\":%.2lf}],\"notesAbove\":[%s],\"notesBelow\":[],\"judgeLineDisappearEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0},{\"startTime\":0.0,\"endTime\":1000000000.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0}],\"judgeLineMoveEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":0.5,\"end\":0.5,\"start2\":0.5,\"end2\":0.5},{\"startTime\":0.0,\"endTime\":128.0,\"start\":0.5,\"end\":0.5,\"start2\":0.2,\"end2\":0.2},{\"startTime\":128.0,\"endTime\":1000000000.0,\"start\":0.5,\"end\":0.5,\"start2\":0.2,\"end2\":0.2}],\"judgeLineRotateEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":0.0,\"end\":0.0,\"start2\":0.0,\"end2\":0.0},{\"startTime\":0.0,\"endTime\":128.0,\"start\":0.0,\"end\":90,\"start2\":0.0,\"end2\":0.0},{\"startTime\":128.0,\"endTime\":1000000000.0,\"start\":90,\"end\":90,\"start2\":0.0,\"end2\":0.0}]},{\"numOfNotes\":%d,\"numOfNotesAbove\":%d,\"numOfNotesBelow\":0,\"bpm\":%.2lf,\"speedEvents\":[{\"startTime\":0.0,\"endTime\":1000000000.0,\"floorPosition\":0.0,\"value\":%.2lf}],\"notesAbove\":[%s],\"notesBelow\":[],\"judgeLineDisappearEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0},{\"startTime\":0.0,\"endTime\":1000000000.0,\"start\":1.0,\"end\":1.0,\"start2\":0.0,\"end2\":0.0}],\"judgeLineMoveEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":0.5,\"end\":0.5,\"start2\":0.5,\"end2\":0.5},{\"startTime\":0.0,\"endTime\":128.0,\"start\":0.5,\"end\":0.5,\"start2\":0.2,\"end2\":0.2},{\"startTime\":128.0,\"endTime\":1000000000.0,\"start\":0.5,\"end\":0.5,\"start2\":0.2,\"end2\":0.2}],\"judgeLineRotateEvents\":[{\"startTime\":-999999.0,\"endTime\":0.0,\"start\":0.0,\"end\":0.0,\"start2\":0.0,\"end2\":0.0},{\"startTime\":0.0,\"endTime\":128.0,\"start\":0.0,\"end\":-90,\"start2\":0.0,\"end2\":0.0},{\"startTime\":128.0,\"endTime\":1000000000.0,\"start\":-90,\"end\":-90,\"start2\":0.0,\"end2\":0.0}]}]}",c1+c2+c3,c1,c1,bpm,spd,ch1,c2,c2,bpm,spd,ch2,c3,c3,bpm,spd,ch3);
    //printf("{"formatVersion":3,"offset":0.0,"numOfNotes":66,"judgeLineList":[{"numOfNotes":66,"numOfNotesAbove":66,"numOfNotesBelow":0,"bpm":102.0,"speedEvents":[{"startTime":0.0,"endTime":1000000000.0,"floorPosition":0.0,"value":1.60}],"notesAbove":[%s]",ch1,ch2,ch3);
    return 0;
}